package com.zhala.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhala.common.annotation.Log;
import com.zhala.common.core.controller.BaseController;
import com.zhala.common.core.domain.AjaxResult;
import com.zhala.common.enums.BusinessType;
import com.zhala.system.domain.ZlSteelPlate;
import com.zhala.system.service.IZlSteelPlateService;
import com.zhala.common.utils.poi.ExcelUtil;
import com.zhala.common.core.page.TableDataInfo;

/**
 * 钢板信息Controller
 * 
 * @author ruoyi
 * @date 2024-11-11
 */
@RestController
@RequestMapping("/system/PLATE")
public class ZlSteelPlateController extends BaseController
{
    @Autowired
    private IZlSteelPlateService zlSteelPlateService;

    /**
     * 查询钢板信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:PLATE:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZlSteelPlate zlSteelPlate)
    {
        startPage();
        List<ZlSteelPlate> list = zlSteelPlateService.selectZlSteelPlateList(zlSteelPlate);
        return getDataTable(list);
    }

    /**
     * 导出钢板信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:PLATE:export')")
    @Log(title = "钢板信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZlSteelPlate zlSteelPlate)
    {
        List<ZlSteelPlate> list = zlSteelPlateService.selectZlSteelPlateList(zlSteelPlate);
        ExcelUtil<ZlSteelPlate> util = new ExcelUtil<ZlSteelPlate>(ZlSteelPlate.class);
        util.exportExcel(response, list, "钢板信息数据");
    }

    /**
     * 获取钢板信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:PLATE:query')")
    @GetMapping(value = "/{ID}")
    public AjaxResult getInfo(@PathVariable("ID") String ID)
    {
        return success(zlSteelPlateService.selectZlSteelPlateByID(ID));
    }

    /**
     * 新增钢板信息
     */
    @PreAuthorize("@ss.hasPermi('system:PLATE:add')")
    @Log(title = "钢板信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZlSteelPlate zlSteelPlate)
    {
        return toAjax(zlSteelPlateService.insertZlSteelPlate(zlSteelPlate));
    }

    /**
     * 修改钢板信息
     */
    @PreAuthorize("@ss.hasPermi('system:PLATE:edit')")
    @Log(title = "钢板信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZlSteelPlate zlSteelPlate)
    {
        return toAjax(zlSteelPlateService.updateZlSteelPlate(zlSteelPlate));
    }

    /**
     * 删除钢板信息
     */
    @PreAuthorize("@ss.hasPermi('system:PLATE:remove')")
    @Log(title = "钢板信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{IDs}")
    public AjaxResult remove(@PathVariable String[] IDs)
    {
        return toAjax(zlSteelPlateService.deleteZlSteelPlateByIDs(IDs));
    }
}
